//
//  HomePopularRecommendationTableViewCell.m
//  gamebox_qpp
//
//  Created by 赵隆杰 on 2022/12/6.
//

#import "HomePopularRecommendationTableViewCell.h"

@interface HomePopularRecommendationTableViewCell ()

@property (weak, nonatomic) IBOutlet YYAnimatedImageView *gameIcon;
@property (weak, nonatomic) IBOutlet UILabel *gameNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *daijinquan;
@property (weak, nonatomic) IBOutlet UILabel *gameSubNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UIImageView *gameBigIcon;
@property (weak, nonatomic) IBOutlet UILabel *activityLabel;
@property (weak, nonatomic) IBOutlet UIView *shadowView;


@end

@implementation HomePopularRecommendationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self.daijinquan cornerRectType:(UIRectCornerTopLeft|UIRectCornerTopRight|UIRectCornerBottomRight) withCornerRadius:7.5];
    
    self.shadowView.layer.shadowOffset = CGSizeMake(0,0);
    self.shadowView.layer.masksToBounds = NO;
    self.shadowView.layer.shadowOpacity = 1;
    self.shadowView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.10].CGColor;
    self.shadowView.layer.shadowRadius = 8;
}

- (void)initCellData0:(NSArray<GameDetailNewModel *> *)array
{
    GameDetailNewModel *detailModel = array.firstObject;
    [self.gameIcon yy_setImageWithURL:[NSURL URLWithString:detailModel.gameMainIcon] placeholder:placeholder_image];
    self.gameNameLabel.text = detailModel.gameName;
    self.gameSubNameLabel.text = [NSString stringWithFormat:@" %@  ", detailModel.gameSubName];
    self.daijinquan.hidden = !detailModel.isDaijinquan.boolValue;

    self.scoreLabel.text = [NSString stringWithFormat:@"%@分", detailModel.gameScore];
    self.typeLabel.text = [detailModel.gameTypes componentsJoinedByString:@"|"];
    
    [self.gameBigIcon yy_setImageWithURL:[NSURL URLWithString:detailModel.gameMainPicture] placeholder:placeholder_image];
    self.activityLabel.text = detailModel.gameVipDesc;
}

+(CGFloat)height:(GameDetailNewModel *)detailModel
{
    CGFloat textHeight = 67;
    if (detailModel.isOpen_Introduce) {
        textHeight = [detailModel.gameIntroduce boundingRectWithSize:CGSizeMake(SL_WINDOW_WIDTH - 28, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:14]} context:nil].size.height+1;
    }
    
    return 40 + 10 + textHeight + 10;
}

@end
